﻿<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="Bookmark" href="/favicon.ico" >
	<link rel="Shortcut Icon" href="/favicon.ico" />
	<!--[if lt IE 9]>
	<script type="text/javascript" src="__STATIC__/admin/lib/html5shiv.js"></script>
	<script type="text/javascript" src="__STATIC__/admin/lib/respond.min.js"></script>
	<![endif]-->
	<link rel="stylesheet" type="text/css" href="__STATIC__/admin/static/h-ui/css/H-ui.min.css" />
	<link rel="stylesheet" type="text/css" href="__STATIC__/admin/static/h-ui.admin/css/H-ui.admin.css" />
	<link rel="stylesheet" type="text/css" href="__STATIC__/admin/lib/Hui-iconfont/1.0.8/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="__STATIC__/admin/static/h-ui.admin/skin/default/skin.css" id="skin" />
	<link rel="stylesheet" type="text/css" href="__STATIC__/admin/static/h-ui.admin/css/style.css" />
	<!--[if IE 6]>
	<script type="text/javascript" src="__STATIC__/admin/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
	<script>DD_belatedPNG.fix('*');</script>
	<![endif]-->
	<title>管理员列表</title>
	<style>
		.b20{
			margin-bottom: 20px;
		}
	</style>
</head>
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i>
	首页 <span class="c-gray en">&gt;</span>
	菜单节点 <span class="c-gray en">&gt;</span>
	节点列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
	<i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
	<div class="text-l b20">
		<a href="javascript:;" onclick="nodeAdd(0,'无')" class="btn btn-primary radius">
			<i class="Hui-iconfont">&#xe600;</i> 新增节点
		</a>
	</div>
	<table class="table table-border table-bordered table-bg">
		<thead>
			<tr class="text-c">
				<th width="40">ID</th>
				<th width="100">节点URL</th>
				<th width="100">节点名称</th>
				<th width="100">级别</th>
				<th width="100">显示状态</th>
				<th width="100">排序</th>
				<th width="100">备注</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
		{volist name="node" id="node"}
			<tr class="text-c">
				<td style="font-weight: bold">{$node.node_id}</td>
				<td>
					{if condition="$node.name == ''"}
						--
					{/if}
				</td>
				<td class="text-l" style="font-weight: bold">&nbsp;&nbsp;&nbsp;&nbsp;{$node.title}</td>
				<td style="font-weight: bold">一级</td>
				<td class="td-status"><span class="label label-success radius">显示</span></td>
				<td>{$node.sort}</td>
				<td>{$node.remark}</td>
				<td class="td-manage">
					<a title="新增子节点" style="text-decoration:none" onClick="nodeAdd({$node.node_id},'{$node.title}')" href="javascript:;" >
						<i class="Hui-iconfont">&#xe600;</i></a>
					<a title="编辑" href="javascript:;" onclick="nodeUpd(0,{$node.node_id},'无')" class="ml-5" style="text-decoration:none">
						<i class="Hui-iconfont">&#xe6df;</i></a>
					<a title="删除" href="javascript:;" onclick="nodeDel({$node.node_id})" class="ml-5" style="text-decoration:none">
						<i class="Hui-iconfont">&#xe6e2;</i></a>
				</td>
			</tr>
		{present name="$node.children"}
			{volist name="$node.children" id="children"}
			<tr class="text-c">
				<td>{$children.node_id}</td>
				<td>{$children.name}</td>
				<td class="text-l">&nbsp;&nbsp;&nbsp;&nbsp;{$children.title}</td>
				<td>二级</td>
				<td class="td-status">
					{if condition="$children.isshow == 0"}
					<span class="label label-success radius">
						显示
					</span>
					{/if}
					{if condition="$children.isshow == 1"}
					<span class="label label-danger radius">
						隐藏
					</span>
					{/if}

				</td>
				<td>{$children.sort}</td>
				<td>{$children.remark}</td>
				<td class="td-manage">
					<a title="编辑" href="javascript:;" onclick="nodeUpd({$node.node_id},{$children.node_id},'{$node.title}')" class="ml-5" style="text-decoration:none">
						<i class="Hui-iconfont">&#xe6df;</i></a>
					<a title="删除" href="javascript:;" onclick="nodeDel({$children.node_id})" class="ml-5" style="text-decoration:none">
						<i class="Hui-iconfont">&#xe6e2;</i></a>
				</td>
			</tr>
			{/volist}
		{/present}
		{/volist}
		</tbody>
	</table>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="__STATIC__/admin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="__STATIC__/admin/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
/*定时器监控刷新*/
var t1 = window.setInterval(function () {
	if (sessionStorage.getItem("refresh") == 1) {
	    sessionStorage.setItem("refresh",0);
        location.reload();
    }
},1000);
/*时间日期*/
function selecttime(flag){
	if(flag==1){
		var endTime = $("#countTimeend").val();
		if(endTime != ""){
			WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',maxDate:endTime})}else{
			WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})}
	}else{
		var startTime = $("#countTimestart").val();
		if(startTime != ""){
			WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:startTime})}else{
			WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})}
	}
}

/*新增节点*/
function nodeAdd(node_id,parent) {
	var title = "新增节点";
    var url = "{:url('node/add')}?pid="+node_id+"&parent="+parent;
	var w = 800;
	var h = 600;
    layer_show(title,url,w,h);
}

/*编辑节点*/
function nodeUpd(pid,node_id,parent) {
    var title = "编辑节点";
    var url = "{:url('node/upd')}?node_id="+node_id+"&parent="+parent+"&pid="+pid;
    var w = 800;
    var h = 600;
    layer_show(title,url,w,h);
}

/*删除节点*/
function nodeDel(node_id) {
    layer.confirm('确认要删除吗？',function(index){
        $.ajax({
            type: "POST",//方法类型
            dataType: "json",//预期服务器返回的数据类型
            url: "{:url('node/del')}",
            data: {
                node_id:node_id
            },
            success: function (res) {
                // console.log(res);
                if (res.code == 1) {
                    layer.alert(res.message);
                }
                if (res.code == 0) {
                    location.reload();//刷新
                }
            },
            error : function() {
                console.log("异常");
            }
        });
    });
}
</script>
</body>
</html>